package cn.lhn.ridersclub.mapper;

import cn.lhn.ridersclub.entity.CommentSupport;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CommentSupportMapper extends BaseMapper<CommentSupport> {

    @Select("select * from comment_support where comment_id in (select id from comment where paper_id = ${paperId});")
    List<CommentSupport> listCommentSupportByPaperId(@Param("paperId") Long paperId);

    @Select("select sum(comment_id = ${commentId}) from comment_support;")
    Long getCommentSupportCount(@Param("commentId") Long commentId);
}
